import axios from 'axios';
import {ajax,base} from './config'


// 关系管理
// 根据数据规则获取所有部门  
export const getDepartZtree = params => { return ajax.getMinData({url:`${base}api/authController/getDepartZtree.do`, params:params}) };
// 用户管理
// 获取列表
export const userManageList = params => { return axios.post(`${base}userController.do?datagrid`, params); };
// 获取角色列表
export const roleList = params => { return axios.post(`${base}userController.do?userRoleData`, params); };
// 添加角色列表
export const roleAddList = params => { return axios.post(`${base}userController.do?selRoleData`, params); };
// 部门列表
export const departList = params => { return axios.post(`${base}departController.do?setPFunction`, params); };
// 用户录入
export const addUserMa = params => { return ajax.postData({url:`${base}userController.do?saveUser`, params}); };
// 用户编辑userController.do?addorupdate
export const editUserMa = params => { return ajax.postData({url:`${base}userController.do?saveUser`, params}); };
// 用户删除
export const delUserMa = params => { return ajax.postData({url:`${base}userController.do?del`, params}); };
// 角色删除
export const delRole = params => { return ajax.postData({url:`${base}userController.do?delUserRole`, params}); };
// 重置密码
export const resetPw = params => { return ajax.postData({url:`${base}userController.do?savenewpwd`, params}); };
// 锁定用户
export const lockUser = params => { return ajax.postData({url:`${base}userController.do?lock`, params}); };
// 激活用户
// export const activeUser = params => { return axios.post(`${base}userController.do?lock`, params); };
// 添加角色
export const addUserRole = params => { return ajax.postData({url:`${base}userController.do?saveUserRole`, params}); };
//解锁用户
export const unlockUser = params => { return ajax.postData({url:`${base}loginController.do?unLock`, params}); };


// 角色管理
// 获取列表
export const roleMaList = params => { return axios.post(`${base}roleController.do?roleGrid`, params); };
// 获取查看成员左边列表
export const memberList1 = params => { return axios.post(`${base}roleController.do?userDatagrOutid`, params); };
// 获取查看成员右边列表
export const memberList2 = params => { return axios.post(`${base}roleController.do?userDatagrInid`, params); };
// 权限设置左边树
export const setAuthority = params => { return axios.post(`${base}roleController.do?setAuthority`, params); };
// 角色录入/编辑
export const saveRole = params => { return ajax.postData({url:`${base}roleController.do?saveRole`, params}); };
// 角色删除
export const deletRole = params => { return ajax.postData({url:`${base}roleController.do?delRole`, params}); };
// 权限菜单列表保存
export const updateAuthority = params => { return ajax.postData({url:`${base}roleController.do?updateAuthority`, params}); };
// 查看成员左边列表添加
export const addRoleUser = params => { return ajax.postData({url:`${base}roleController.do?addRoleUser`, params}); };
// 查看成员右边列表删除
export const deleteRoleUser = params => { return ajax.postData({url:`${base}roleController.do?deleteRoleUser`, params}); };
// roleController.do?operationListForFunction&functionId=390663443046207488&roleId=8afc99b04c26ad0b014c26af28900042&_=1498010180056
export const operationList = params => { return ajax.postData({url:`${base}roleController.do?getOperationListForFunction`, params}); };
// roleController.do?updateOperation
export const updateOperation = params => { return ajax.postData({url:`${base}roleController.do?updateOperation`, params}); };

// 部门管理
// 获取列表
export const depList = params => { return axios.post(`${base}departController.do?departgrid`, params); };
// 上级部门树
export const getDepComboTree = params => { return axios.post(`${base}departController.do?getDepComboTree`, params); };
// 部门录入检测部门名
export const checkdepart = params => { return axios.post(`${base}departController.do?checkdepart`, params); };
// 部门录入
export const save = params => { return ajax.postData({url:`${base}departController.do?save`, params}); };
// 获取部门信息
export const getDepartData = params => { return axios.post(`${base}departController.do?getDepartData`, params); };
// 部门删除
export const departContDel = params => { return ajax.postData({url:`${base}departController.do?del`, params}); };
// 获取用户列表
export const userDatagrid = params => { return axios.post(`${base}departController.do?userDatagrid`, params); };
// 用户列表删除
export const del = params => { return ajax.postData({url:`${base}userController.do?del`, params}); };
// 获取用户信息
export const getUserData = params => { return axios.post(`${base}userController.do?getUserData`, params); };


//数据字典
//获取列表
export const dataList = params => { return axios.post(`${base}systemController.do?typeGroupGrid`, params); };
// 获取数据字典分组信息
export const getTypeGroupData = params => { return axios.post(`${base}systemController.do?getTypeGroupData`, params); };
// 获取数据字典信息
export const getTypeData = params => { return axios.post(`${base}systemController.do?getTypeData`, params); };
// 字典项列表
export const ditionaryList = params => { return axios.post(`${base}systemController.do?getTypeTree`, params); };
// 字典录入
export const addData = params => { return ajax.postData({url:`${base}systemController.do?saveTypeGroup`, params}); };
// 字典编辑
export const eaitData = params => { return ajax.postData({url:`${base}systemController.do?saveTypeGroup`, params}); };
//字典删除
export const delTypeGroup = params => { return ajax.postData({url:`${base}systemController.do?delTypeGroup`, params}); };
// 字典项添加
export const getTypeComboTree = params => { return axios.post(`${base}systemController.do?getTypeComboTree`, params); };
// 字典项添加提交
export const saveType = params => { return ajax.postData({url:`${base}systemController.do?saveType`, params}); };
// 字典项删除
export const delType = params => { return ajax.postData({url:`${base}systemController.do?delType`, params}); };

//菜单管理
//获取列表
export const getMenuList = params => { return axios.post(`${base}functionController.do?functionGrid`, params);};
//添加菜单
export const addMenu = params => { return axios.post(`${base}functionController.do?saveFunction`, params);};
//删除菜单
export const delMenu = params => { return axios.post(`${base}functionController.do?del`, params);};
//获取按钮设置
export const getBtnSetting = params => { return axios.post(`${base}functionController.do?opdategrid`, params);};
//获取操作录入
export const addControl = params => { return axios.post(`${base}functionController.do?saveop`, params);};
//删除操作
export const delControl = params => { return axios.post(`${base}functionController.do?delop`, params);};
//获取菜单详情
export const getMenuDetail = params => {return axios.post(`${base}functionController.do?getFunctionData`,params);};
//获取权限菜单
export const getAuthMenu = params => { return ajax.getMinData({url:`${base}api/authController/getAuthMenu.do`, params}); };
//获取菜单操作权限
export const getAuthMenuOperation = params => { return ajax.getMinData({url:`${base}api/authController/getAuthMenuOperation.do`, params}); };